<?php

require_once 'SmartL/Application/Login/UserPreferences/Interface.php';

class Demo_UserPreferences implements SmartL_Application_Login_UserPreferences_Interface
{
	/**
	 * Returns name of current user prefered template.
	 * @return string
	 */
	public function getTemplateName()
	{
		$user = Zend_Auth::getInstance()->getIdentity();
		$moduleName = SmartL_Application::getInstance()->getActualModule()->getName();
		if ( $user and $moduleName != "Admin") {
			return $user->templateId;
		}
		else {
			return null;
		}
	}
	
	/**
	 * Returns name of current user prefered skin of user prefered template.
	 * Note that this skin must belongs to user prefered template.
	 * @return string
	 */
	public function getSkinName()
	{
		$user = Zend_Auth::getInstance()->getIdentity();
		$moduleName = SmartL_Application::getInstance()->getActualModule()->getName();
		if ( $user and $moduleName != "Admin") {
			return $user->skinId;		
		}
		else {
			return null;
		}
	}
	
	/**
	 * Returns current user prefered language.
	 * @return SmartL_Application_Config_LanguageInfo
	 */
	public function getLanguage()
	{
		$user = Zend_Auth::getInstance()->getIdentity();
		$moduleName = SmartL_Application::getInstance()->getActualModule()->getName();
		if ( $user and $moduleName != "Admin") {		
			$langs = SmartL_Application::getInstance()->getSupportedLanguages();
			return $langs[Zend_Auth::getInstance()->getIdentity()->languageId];
		}
		else {
			return null;
		}
	}
}